package com.sunducation.wts.databinding5

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView

class MainActivity : AppCompatActivity() {


    private lateinit var mRecyclerView : RecyclerView

    private var mData:ArrayList<Student>  = ArrayList<Student>()
    init{
        for (i in 1..10) {
            mData.add(Student("laoder" + i, 18 + i))
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        mRecyclerView = findViewById(R.id.recycler)
        mRecyclerView.setLayoutManager(
            LinearLayoutManager(this,
            LinearLayoutManager.VERTICAL, false)
        );
        mRecyclerView.setAdapter(MyAdapter(mData));

    }
}
